﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PLC.Domain.Entity;

namespace PLC.Infrastructure.DbContext.Config;

public class PressureDataConfig:IEntityTypeConfiguration<PressureData>
{
    public void Configure(EntityTypeBuilder<PressureData> builder)
    {
        builder.ToTable("tb_data_pressure");
        builder.HasKey(p => p.Id);
        builder.Property(p => p.Id).ValueGeneratedNever();
        builder.HasIndex(p => new {p.LowerEndPlateCode,p.UpperEndPlateCode});
        builder.Property(p => p.Data).IsRequired().HasMaxLength(1024).HasDefaultValue("");
        builder.Property(p => p.LowerEndPlateCode).IsRequired().HasMaxLength(64).HasDefaultValue("");
        builder.Property(p => p.UpperEndPlateCode).IsRequired().HasMaxLength(64).HasDefaultValue("");
    }
}